'use strict';

let Koa = require('koa');
let bodyParser = require('koa-bodyparser');
let controller = require('./controllers');
let templating=require('./templating');
let staticRes=require('koa-static');
let session = require('./session');
let models=require('./models');
let app = new Koa();

app.use(session(app));

app.use(staticRes('.'))

app.use(staticRes(__dirname+'/statics'));

app.use(bodyParser());

app.use(templating);

app.use(controller());

(async ()=>{
      // await models.sync();
})();

let port = 5000;

app.listen(port);

console.log(`http://127.0.0.1:${port}`);